package study.linkedlist;

public class DoubleLinkedListDemo {
    public static void main(String[] args) {
        DoubleLinkedList doubleLinkedList = new DoubleLinkedList();
        //添加节点
        doubleLinkedList.add(new Node2(1, "节点1"));
        doubleLinkedList.add(new Node2(2, "节点2"));
        doubleLinkedList.add(new Node2(3, "节点3"));

        //按顺序添加节点
//        doubleLinkedList.addByOrder(new Node2(2, "节点2"));
//        doubleLinkedList.addByOrder(new Node2(1, "节点1"));
//        doubleLinkedList.addByOrder(new Node2(3, "节点3"));
//        doubleLinkedList.list();

        //打印链表
        doubleLinkedList.list();

        //修改节点信息
        doubleLinkedList.update(new Node2(1,"节点1111111111~~"));
        System.out.println("======== 修改后的链表 =======");
        doubleLinkedList.list();

        //删除节点
        doubleLinkedList.delete(2);
        System.out.println("======== 删除后的链表 =======");
        doubleLinkedList.list();

    }
}
